package com.shy.example.alibaba.consumer.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@RequestMapping("dept")
@Slf4j
public class DeptController {
    @Resource
    private RestTemplate restTemplate;

    @GetMapping("nacos/{id}")
    public String paymentInfo(@PathVariable("id") Long id){
        String result = restTemplate.getForObject("http://spring-cloud-alibaba-provider/dept/nacos/" + id, String.class);
        log.info("result: {}", result);
        return result;
    }

}
